<template>
  <div id="home">
    <el-container id="elc1" >
      <el-header>
        <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
                    <el-menu-item index="0"><a href="http://localhost:8080/KMap" target="_self">网络知识图谱</a></el-menu-item>
                    <el-menu-item index="1"><a href="http://localhost:8080/Search" target="_blank">详细搜索</a></el-menu-item>
                    <el-menu-item index="3"><a href="http://localhost:8080/control" target="_blank">管理员中心</a></el-menu-item>
          <!--          <el-menu-item index="2"><a href="http://192.168.1.108:8080/Manager" target="_blank">修改结点</a></el-menu-item>-->
          <!--          <el-menu-item index="3"><a href="http://192.168.1.108:8080/Post" target="_blank">Post</a></el-menu-item>-->
          <!--          <el-menu-item index="4"><a href="http://192.168.1.108:8080/Upload" target="_blank">上传结点</a></el-menu-item>-->
          <!--          <el-menu-item index="5"><a href="http://192.168.1.108:8080/degree" target="_blank">degree</a></el-menu-item>-->
          <!--          <el-menu-item index="6"><a href="http://192.168.1.108:8080/EditPage" target="_blank">EditPage</a></el-menu-item>-->
          <!--          <el-menu-item index="7"><a href="http://192.168.1.108:8080/UserInfo" target="_blank">修改密码</a></el-menu-item>-->
          <el-submenu index="2">
            <template slot="title">用户中心</template>
            <el-menu-item v-show="sbswzy" index="2"><a href="http://localhost:8080/Manager" target="_blank">修改结点</a></el-menu-item>
            <el-menu-item v-show="sbswzy" index="4"><a href="http://localhost:8080/Upload" target="_blank">上传结点</a></el-menu-item>
            <el-menu-item index="7"><a href="http://localhost:8080/UserInfo" target="_blank">修改密码</a></el-menu-item>
            <el-menu-item index="7" @click="qcsj"><a href="http://localhost:8080/" target="_self">退出登录</a></el-menu-item>
          </el-submenu>
        </el-menu>
      </el-header>

      <el-container id="elc2">
        <el-aside :width="isCollapse ? '70px' : '290px'">
          <!--        开关-->
          <!--          <div class="kaiguan">-->
          <!--            <el-switch v-model="isCollapseSwitch" inactive-color="#13ce66">-->
          <!--            </el-switch>-->
          <!--          </div>-->

          <!--        侧边栏菜单-->
          <!--          <el-menu-->
          <!--              default-active="1"-->
          <!--              :collapse="isCollapse"-->
          <!--              :collapse-transition="false"-->
          <!--              router-->
          <!--          >-->

          <!--            <el-menu-item-->
          <!--                :index="'videoAndPdf?value=' + item.pointId"-->
          <!--                v-for="item in KnowList"-->
          <!--                :key="item.pointId"-->
          <!--            >-->
          <!--              <span slot="title">{{ item.pointId }} {{ item.point.pointName }}</span>-->
          <!--            </el-menu-item>-->

          <!--          </el-menu>-->
          <Degree style="height: 100%;"/>
        </el-aside>
        <el-main>
          <!-- 路由占位符 -->
          <router-view></router-view>
        </el-main>
      </el-container>

    </el-container>
    <!--    <div class="bianji">-->
    <!--      <el-tooltip-->
    <!--          class="item"-->
    <!--          effect="dark"-->
    <!--          content="编辑知识"-->
    <!--          placement="left"-->
    <!--      >-->
    <!--        <el-button-->
    <!--            type="primary"-->
    <!--            icon="el-icon-edit"-->
    <!--            circle-->
    <!--            @click="openEditPage"-->
    <!--        ></el-button>-->
    <!--      </el-tooltip>-->
    <!--    </div>-->

    <!--    <div class="shezhi">-->
    <!--      <el-tooltip-->
    <!--          class="item"-->
    <!--          effect="dark"-->
    <!--          content="用户设置"-->
    <!--          placement="left"-->
    <!--      >-->
    <!--        <el-button-->
    <!--            type="primary"-->
    <!--            icon="el-icon-setting"-->
    <!--            circle-->
    <!--            @click="openSetting"-->
    <!--        ></el-button>-->
    <!--      </el-tooltip>-->
    <!--    </div>-->
  </div>
</template>

<script>
import Degree from './degree'

export default {
  name: "home",
  components: {
    Degree,
  },
  data() {
    return {
      activeIndex: '0',
      activeIndex2: '1',

      pointId: "",

      drawer: false,
      direction: 'btt',

      // 是否折叠
      isCollapse: false,
      isCollapseSwitch: false,

      KnowList: [],
      sbswzy:false,
    };
  },
  created() {
    this.getKnowList();
    this.sbsWZY();
  },
  methods: {
    qcsj() {
      window.localStorage.clear()
    },
    sbsWZY() {
      if(window.localStorage.getItem('uname') === "\"wzy\"")
        this.$data.sbswzy = true;
      // this.$data.sbswzy = window.localStorage.getItem('uname')
    },
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },

    async getKnowList() {
      const {data: res} = await this.$http.get(
          "http://1.117.249.55//2backcode/address/findall"
      );
      this.KnowList = res;
    },

    handleOpen(key, keyPath) {
      console.log(key, keyPath);

    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    // notification 通知

    // openTongzhi()
    // {
    //   const h = this.$createElement;
    //   this.$notify({
    //     title: "关于打赏",
    //     message: h(
    //         "i",
    //         {style: "color: teal"},
    //         "谢谢你对我们网站内容的认可，打赏二维码在pdf的尾部，可以请作者喝杯咖啡哦~"
    //     ),
    //   });
    // },
    openEditPage() {
      console.log(22222);
      this.$router.push({path: "/EditPage"});
    },
    openSetting() {
      console.log(11111);
      this.$router.push({path: "/UserInfo"});
    },

  },
  watch: {
    isCollapseSwitch(newValue, oldValue) {
      this.isCollapse = !this.isCollapse;
    },

  },
};
</script>

<style scoped>
#home {
  /*padding: 0;*/
  height: 100%;
}

/*.el-container {*/
/*  height: 100%;*/
/*}*/

#elc1 {
  height: 100%;
}

#elc2 {
  /*height: 90vmin;*/
}

.el-header {
  /*background-color: #195bff;*/
}

.el-main {
  background-color: #e9eef3;
  padding: 0;
}

.kaiguan {
  padding: 5px;
  padding-left: 10px;
}

.bianji {
  position: fixed;
  bottom: 50px;
  left: 0;
  padding: 5px;
  padding-left: 10px;
  padding-bottom: 10px;
}

.shezhi {
  position: fixed;
  bottom: 0;
  left: 0;
  padding: 5px;
  padding-left: 10px;

}

.pinglun {
  position: fixed;
  bottom: 0;
  left: 0;
  padding: 5px;
  padding-left: 10px;
  padding-bottom: 80px;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 250px;
}
</style>
